//
//  AppMacro.h
//  BuildingMaterialsMall
//
//  Created by HuoMeina on 2018/3/30.
//  Copyright © 2018年 HuoMeiNa. All rights reserved.
//

#ifndef AppMacro_h
#define AppMacro_h

///屏幕宽度
#define kMainScreenWidth     [UIScreen mainScreen].bounds.size.width
///屏幕高度
#define kMainScreenHeight    [UIScreen mainScreen].bounds.size.height
///高度比例（用高*kHeightScale，得出比例高）
#define kHeightScale         [[UIScreen mainScreen] bounds].size.width/375
///宽度比例（用宽*kWidthScale，得出比例宽）
#define kWidthScale          [[UIScreen mainScreen] bounds].size.height/667

/** 弱引用 */
#define WEAKSELF __weak typeof(self) weakSelf = self;

// 字体大小(常规/粗体)
#define BOLDSYSTEMFONT(FONTSIZE)[UIFont boldSystemFontOfSize:FONTSIZE]
#define SYSTEMFONT(FONTSIZE)    [UIFont systemFontOfSize:FONTSIZE]
#define KFONT(NAME, FONTSIZE)    [UIFont fontWithName:(NAME) size:(FONTSIZE)]

////添加字体
#define KMedium  @"Avenir-Medium"
#define KHeavy   @"Avenir-Heavy"
#define KLight   @"Avenir-Light"
#define KBlack   @"Avenir-Black"
#define KBook    @"Avenir-Book"
#define KRoman   @"Avenir-Roman"




#define SVP_show_time 1.5


///系统版本号是否ios11
#define ISIOS11               @available(iOS 11.0, *)
///加载storyboard
#define STORYBOARD(NAME)      [UIStoryboard storyboardWithName:NAME bundle:[NSBundle mainBundle]]
///提示信息
#define SVPROGRESSHUD(NAME)   [SVProgressHUD showImage:[UIImage imageNamed:@""] status:NAME]
//适配iPhone
#define is_iPhone5 568 == kMainScreenHeight
///////适配iphone X
#define is_iPhoneX  CGRectGetHeight([UIApplication sharedApplication].statusBarFrame) == 20 ? NO : YES


#define SVSTATUS(Info);\
\
[SVProgressHUD showWithStatus:(Info)];\
[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];

// weakSelf
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
#define SVMISS    [SVProgressHUD dismiss];
#define SVERROR(Info,interval);\
\
[SVProgressHUD showErrorWithStatus:(Info)];\
[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];\
[SVProgressHUD dismissWithDelay:(interval)];

#define SVP_showInfoWithStatus(info);\
\
[SVProgressHUD setMinimumDismissTimeInterval:1.5];\
[SVProgressHUD showInfoWithStatus:(info)];

#define SVP_showSuccessWithStatus(info);\
\
[SVProgressHUD setMinimumDismissTimeInterval:1.5];\
[SVProgressHUD showSuccessWithStatus:(info)];

//—————————————不用你把所有NSLog的删除或注释，直接修改#if 判断的值就行了(1执行,0不执行)——————————————

#if 1

#define JXLog( s, ... ) NSLog( @"< %@:(%d) > %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )

#else

#define JXLog( s, ... )

#endif


///分页 页值 默认10
#define kPageSize @"10"
///分页 页序 从0开始
#define kPageIndex @"0"

///tabbar模块编号
//#define HOMEPAGE                 0
//#define ELECTRONICBILLING        1
//#define CHAT                     2
//#define MY                       3


/* View 坐标(x,y)和宽高(width,height) *****************************************/

#define X(v)                    (v).frame.origin.x
#define Y(v)                    (v).frame.origin.y
#define WIDTH(v)                (v).frame.size.width
#define HEIGHT(v)               (v).frame.size.height

#define MinX(v)                 CGRectGetMinX((v).frame)
#define MinY(v)                 CGRectGetMinY((v).frame)

#define MidX(v)                 CGRectGetMidX((v).frame)
#define MidY(v)                 CGRectGetMidY((v).frame)

#define MaxX(v)                 CGRectGetMaxX((v).frame)
#define MaxY(v)                 CGRectGetMaxY((v).frame)


#define RECT_CHANGE_x(v,x)          CGRectMake(x, Y(v), WIDTH(v), HEIGHT(v))
#define RECT_CHANGE_y(v,y)          CGRectMake(X(v), y, WIDTH(v), HEIGHT(v))
#define RECT_CHANGE_point(v,x,y)    CGRectMake(x, y, WIDTH(v), HEIGHT(v))
#define RECT_CHANGE_width(v,w)      CGRectMake(X(v), Y(v), w, HEIGHT(v))
#define RECT_CHANGE_height(v,h)     CGRectMake(X(v), Y(v), WIDTH(v), h)
#define RECT_CHANGE_size(v,w,h)     CGRectMake(X(v), Y(v), w, h)





#endif /* AppMacro_h */
